package com.example.movie.adapter

import androidx.recyclerview.widget.DiffUtil
import com.bawei.common.entity.MovieVideoEntity

/**
 * 数据实体对象比较器
 */
object MovieEntityComparator: DiffUtil.ItemCallback<MovieVideoEntity>() {

    /**
     * 通过ID简单对比两个对象是否为同一个
     */
    override fun areItemsTheSame(oldItem: MovieVideoEntity, newItem: MovieVideoEntity): Boolean {
       return oldItem.id == newItem.id
    }

    /**
     * 通过对比两个对象的内容是否一样
     */
    override fun areContentsTheSame(oldItem: MovieVideoEntity, newItem: MovieVideoEntity): Boolean {
        return oldItem == newItem
    }


}